using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_PHYSICIAN_BillMap : EntityTypeConfiguration<SO_PHYSICIAN_Bill>
    {
        public SO_PHYSICIAN_BillMap()
        {
            // Primary Key
            this.HasKey(t => new { t.sumfields, t.dimfields });

            // Properties
            this.Property(t => t.Physician__)
                .HasMaxLength(8);

            this.Property(t => t.Physician)
                .HasMaxLength(35);

            this.Property(t => t.Doc_type)
                .HasMaxLength(8);

            this.Property(t => t.Bill_cur)
                .HasMaxLength(5);

            this.Property(t => t.Physician_Cur)
                .HasMaxLength(5);

            this.Property(t => t.Bill__)
                .HasMaxLength(8);

            this.Property(t => t.batch)
                .IsFixedLength()
                .HasMaxLength(50);

            this.Property(t => t.Notes)
                .HasMaxLength(100);

            this.Property(t => t.sumfields)
                .IsRequired()
                .HasMaxLength(15);

            this.Property(t => t.dimfields)
                .IsRequired()
                .HasMaxLength(37);

            // Table & Column Mappings
            this.ToTable("SO_PHYSICIAN_Bill");
            this.Property(t => t.Physician__).HasColumnName("Physician_#");
            this.Property(t => t.Physician).HasColumnName("Physician");
            this.Property(t => t.Doc_type).HasColumnName("Doc_type");
            this.Property(t => t.voucher).HasColumnName("voucher");
            this.Property(t => t.Bill_cur).HasColumnName("Bill_cur");
            this.Property(t => t.Amount).HasColumnName("Amount");
            this.Property(t => t.Physician_Cur).HasColumnName("Physician_Cur");
            this.Property(t => t.Physician_Cur_amount).HasColumnName("Physician_Cur_amount");
            this.Property(t => t.Base_1).HasColumnName("Base_1");
            this.Property(t => t.Base_2).HasColumnName("Base_2");
            this.Property(t => t.Bill__).HasColumnName("Bill_#");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.Reference).HasColumnName("Reference");
            this.Property(t => t.DocPrimaryKey).HasColumnName("DocPrimaryKey");
            this.Property(t => t.batch).HasColumnName("batch");
            this.Property(t => t.PSID).HasColumnName("PSID");
            this.Property(t => t.Notes).HasColumnName("Notes");
            this.Property(t => t.sumfields).HasColumnName("sumfields");
            this.Property(t => t.dimfields).HasColumnName("dimfields");
        }
    }
}
